package com.zichong.wiki.config;

import org.mybatis.spring.annotation.MapperScan;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.core.env.Environment;

/**
 * @SpringBootApplication 里面有个 @ComponentScan 默认会扫描当前 package 下面的所有子包, 即 config 下面
 * 显示地使用 @ComponentScan 来重写扫描的 package,
 * 当项目启动的时候, 会扫描 package -> com.zichong
 * 扫描多个包: @ComponentScan({"com.zichong", "com.test"})
 */
@ComponentScan("com.zichong")
@SpringBootApplication
@MapperScan("com.zichong.wiki.mapper")
public class WikiApplication {

	private static final Logger LOG = LoggerFactory.getLogger(WikiApplication.class);

	public static void main(String[] args) {

		SpringApplication app = new SpringApplication(WikiApplication.class);
		Environment env = app.run(args).getEnvironment();

		LOG.info("Start Successfully.");
		LOG.info("Address: \thttp://127.0.0.1:{}", env.getProperty("server.port"));
	}

}
